2014-11-05

git is a distributed version control system

git is also a lot like dancing

You can dance on your own ..

.. or with your friends

But alone or in groups, git is fun & useful!

git is a useful tool for

  • tracking changes to files
  • organizing projects
  • sharing data and code

Today: the Basic Step

  • starting a repo
  • making commits
  • using remotes

Dancing shoes:

the necessary equipment

  • Rstudio
  • git
  • git bash (windows)

Start the music!

  • create a new directory

    suggestion: not in your desktop

  • open git bash or terminal

In a terminal

cd path/to/your/directory
git init

Do some work

  • open a text editor something simple: notepad, gedit, nano
  • write out the title of a project you're working on:
# This is my title
  • save in your new directory as README.md

Back in the command line:

  • git status
  • git add README.md
  • git commit -m "adding a readme file"

Back in the editor:

  • add your name
  • save
  • git status
  • git add .
  • git commit -m "adding my name"

The Step:

  • work
  • save
  • git add .
  • git commit
  • work
  • save
  • git add .
  • git commit

Let's take a look at our progress

git log
git log -p -3

how git stores data

The Three Areas

This is the main thing to remember about Git if you want the rest of your learning process to go smoothly. Git has three main states that your files can reside in: committed, modified, and staged. git book

Other steps (if we have time):

  • To the side!

    git branch
  • To the back!

    git checkout

Get out on the floor

Add a remote repository:

  • First, go to github and start a repository
  • Follow the steps!

    git remote add origin https://github.com/aammd/practice.git
    git push -u origin master
  • Rstudio buttons greyed out?

Github

Cloning a repository

Cloning a repository gives you a copy Let's clone this repository

https://github.com/aammd/git-dance